<template>
    <div >
      <div class="hd">
        <span @click="$router.go(-1)"> 返回 </span>
        个人中心
      </div>
       <div class=" actop">
            <div class="avt fl">
              <img :src="$store.state.wxuser.head_img" alt="">
              <div id="qrcode" @click="showMaskClosable=true" v-if="$store.state.wxuser.agent==1">
                <i class="iconfont icon-erweima" style="font-size: 25px;color:#666"></i>
              </div>
            </div>
            <div class="fr" style="text-align: right;">
              <div class="acname">您好，{{$store.state.wxuser.nickname}}</div>
              <span>注册时间:{{new Date()|moment('YYYY-MM-DD hh:mm:ss')}}</span>
            </div>
       </div>
       <div class="aczone">
         <div class="acitem clearfix"  >
           <div class="fl">
              {{ac_fee}}
             <span>可用余额</span>
           </div>
           <div class="fr">
             <div class="nbt" @click="$router.push({name:'charge'})">充值</div>
             <div class="nbt" @click="$router.push({name:'aclist'})">资金记录</div>
           </div>
         </div>
            <div class="acitem clearfix"  @click="$router.push({name:'OrderList'})">
             <div class="fl">
               我的订单
               <span>查看所有订单信息</span>
             </div>
            </div>
         <div class="acitem clearfix" >
           <div class="fl">
             个人信息
             <span>个人信息</span>
           </div>
           <div class="fr" @click="$router.push({name:'Userinfo'})">
             <template v-if="$store.state.wxuser.xyf==1">免押金</template>
             <template v-else-if="$store.state.wxuser.real_name && $store.state.wxuser.phone && $store.state.wxuser.id_num">已完善</template>
             <template v-else><span class="mr">未完善</span></template>
           </div>

         </div>
             <div class="acitem clearfix" >
               <div class="fl">
                 身份证认证
                 <span>认证身份证信息</span>
               </div>
               <div class="fr" @click="$router.push({name:'Idphoto'})">

                 <template v-if="$store.state.wxuser.id_photo_a && $store.state.wxuser.id_photo_b">已上传</template>
                 <template v-else><span class="mr">未认证</span></template>
               </div>

             </div>
             <div class="acitem clearfix">
               <div class="fl">
                 驾驶证认证
                 <span>认证驾驶证信息</span>
               </div>
               <div class="fr"  @click="$router.push({name:'LicenPhoto'})">
                 <template v-if="$store.state.wxuser.license_a && $store.state.wxuser.license_b">已上传</template>
                 <template v-else><span class="mr">未认证</span></template>
               </div>
             </div>
         <div class="acitem clearfix">
           <div class="fl">
             <a href="tel:18174123678" >
               联系客服
               <span>我们将为您提高高标准的客服服务</span>
             </a>
           </div>
         </div>

       </div>

      <md-landscape v-model="showMaskClosable" :mask-closable="true">
        <qrcode :value="nurl"></qrcode>
      </md-landscape>

    </div>
</template>

<script>
export default {
  name: 'Account',
  data () {
    return {
      showMaskClosable: false,
      nurl: `http://tmc.guotaijinxing.com/wx/entrytmc?relId=` + this.$store.state.wxuser.openid,
      ac_fee: '0.00'
    }
  },
  created: async function () {
    this.ac_fee = this.$store.state.wxuser.balance
    this.$store.dispatch('getUser')
  },
  beforeMount: async function () {
    let _url = await this.$api.post('/getUrl', {openid: this.$store.state.wxuser.openid})
    this.nurl = _url.data
    this.getu()
  },
  methods: {
    async getu () {
      let _u = await this.$api.post('/getu', {openid: this.$store.state.wxuser.openid})
      if (_u.data.state) {
        this.ac_fee = _u.data.data.balance
      }
    }
  }
}
</script>

<style scoped>
  .br{
    border:1px solid red
  }
  .actop{
    height: 60px;
    padding:30px 20px 20px;
    border-bottom:2px solid #e9e9e9
  }

  .avt{
    height: 60px;
    width: 60px;
    box-sizing: border-box;
    border-radius: 50%;
    position: relative;
  }
  .avt > img{
    width: 100%;
    border-radius: 50%;
  }
  .acname{
    font-weight: 500;
    font-size: 25px;
    color:#666;
  }
  .acname + span{
    font-size: 12px;
    color:#999
  }
.aczone{
  padding:10px 20px
}
  .acitem{
    padding:10px 0px;
    border-bottom:1px solid #e9e9e9;
    color:#666;
    position: relative;
    font-size: 16px;
  }
.acitem span{
  display: block;
  font-size: 12px;
  line-height:20px;
  color:#999
}
  .acitem .fr{
    font-size: 14px;
    padding-top: 10px;
  }
  #qrcode{
    width: 30px;
    height: 30px;
    position: absolute;
    top:50%;
    transform: translateY(-50%);
    left:70px
  }
  .acitem .mr{
    color:orangered;
    font-size: 14px;
  }
  .nbt{
    display: inline-block;
    padding:5px 15px;
    border:1px solid #4a4c5b;
    margin-right: 5px;
    border-radius: 5px;
  }
</style>
